<?php

namespace App\Admin\Exports;

use App\Admin\Exports\Sheet\CategorySheet;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use Maatwebsite\Excel\Concerns\WithStyles;

class CategoryExport implements WithMultipleSheets, ShouldAutoSize, WithStyles
{
    public function sheets(): array
    {
        $sheetTitle = config('rj-excel-export.category.sheet_title', '书籍');

        return [
            $sheetTitle => new CategorySheet(),
        ];
    }

    public function styles(Worksheet $sheet)
    {
        return [
            1 => config('rj-excel-export.export.header_style', [
                'font' => ['bold' => true],
                'fill' => [
                    'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
                    'startColor' => ['rgb' => 'CCCCCC'],
                ],
            ]),
        ];
    }
}
